package com.hs.communication.common.feign;

import com.hs.common.core.constant.SecurityConstants;
import com.hs.common.core.constant.ServiceNameConstants;
import com.hs.common.core.domain.Result;
import com.hs.communication.common.entity.Charger;
import com.hs.communication.common.entity.ChargerData;
import com.hs.communication.common.entity.UpsData;
import com.hs.communication.common.entity.vo.DeviceVo;
import com.hs.communication.common.fallback.RemoteChargerFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 远程调用 charger 服务
 */
@FeignClient(contextId = "remoteChargerService", value = ServiceNameConstants.CHARGER_SERVICE, fallbackFactory = RemoteChargerFallbackFactory.class)
public interface RemoteChargerService {
    /**
     * 获取充电桩统计数据
     */
    @GetMapping(value = "/charger/statistics")
    Result<DeviceVo> getStatistics(@RequestParam("userId") long userId,@RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    @GetMapping(value = "/charger/sns")
    Result<List<String>> getSns(@RequestParam("userId") long userId, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    /**
     * 插入充电桩实时数据
     *
     * @param chargerData,source
     */
    @PostMapping(value = "/charger/data")
    Result<Boolean> insert(@RequestBody ChargerData chargerData, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    //更改为在线离线状态和相应的时间
    @PutMapping(value = "/charger/status")
    Result<Boolean> updateStatus(@RequestBody Charger charger, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
}
